package com.joven.core.controller;

import com.joven.core.constant.PropertiesCont;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

@RestController
@RequestMapping("/helloTest")
public class TestController {

//    @Autowired
    private PropertiesCont propertiesCont;

    @Autowired
    public void setPropertiesCont(PropertiesCont propertiesCont) {
        this.propertiesCont = propertiesCont;
    }

    @GetMapping("/joven")
//    @RequestMapping("/joven")
    public String helloTest(){
        //格式化
        DateTimeFormatter fmDate = DateTimeFormatter.ofPattern("yyyy-MM-dd");

        //当天
        LocalDate today = LocalDate.now();

        return today+"|Joven_YU|";
    }

    @GetMapping("/config")
    public String helloNacosConfig(){
        String x = propertiesCont.getName().concat(":").concat(propertiesCont.getServerAddr());
        return x;
    }
}
